package com.kkb.service;

import com.kkb.mapper.UserMapper;
import com.kkb.pojo.User;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class LoginService {
    @Resource
    private UserMapper userMapper;

    @Transactional(propagation = Propagation.REQUIRED,readOnly = true)
    public User queryById(Integer u_loginName){
        return userMapper.selectByPrimaryKey(u_loginName);
    }

    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
    public Integer update(User user){
        return userMapper.updateByPrimaryKeySelective(user);
    }
}
